import allure
import pymysql
import requests

from config.config import *


@allure.step("发送http请求")
def send_http_request(request_data):
    res=requests.request(**request_data)
    return res

def send_jdbc_request(sql):
    conn = pymysql.Connect(
        host=HOST,
        port=PORT,
        database=DATABASE,
        user=USER,
        password=PASSWORD
    )
    # 建桥
    cur = conn.cursor()
    sql = sql
    cur.execute(sql)
    # result=cur.fetchall()#返回的是一个[("admin")，("123")]
    result = cur.fetchone()[0]
    # print(type(result[0]))
    cur.close()
    conn.close()
    return result
